import java.util.Arrays;

//import java.util.*;
//import java.util.ArrayList;
//public class Stack {
//    public static void main1(String[] args) {
//        Stack<Integer> stack = new Stack<>();
//        Stack.push(1);
//        Stack.push(2);
//        Stack.push(3);
//        Stack.push(4);
//        System.out.println(stack.pop());
//        System.out.println(stack.peek());
//        System.out.println(stack.empty());
//        System.out.println(stack.isempty());
//    }
//
//    public static void main2(String[] args) {
//        public boolean IsPopOrder ( int[] pushA, int[] popA){
//            Stack<Integer> stack = new Stack<>();
//            int j = 0;
//            for (int i = 0; i < pushA.length; i++) {
//                stack.push(pushA[i]);
//                while (j < popA.length && !stack.empty() && stack.peek() == popA[j]) {
//                    stack.pop();
//                    j++;
//                }
//            }
//            return stack.empty();
//        }
//    }
//}
/*class MyStack {
    public int[] elem;
    public int usedSize;

    public MyStack() {
        this.elem = new int[5];
    }

    public void push(int val) {
        if (isFull()) {
            this.elem = Arrays.copyOf(this.elem, 2 * this.elem.length);
        }

        this.elem[this.usedSize] = val;
        this.usedSize++;
    }

    public boolean isFull() {
        return this.usedSize == this.elem.length;
    }

    public int pop() {
        if (isEmpty()) {
            throw new RuntimeException("栈为空! ");
        }
        int oldVal = this.elem[usedSize - 1];
        this.usedSize--;
        return oldVal;
    }

    public int peek() {
        if (isEmpty()) {
            throw new RuntimeException("栈为空! ");
        }
        return this.elem[usedSize - 1];
    }

    public boolean isEmpty() {
        return this.usedSize == 0;
    }
public class Stack {
        public static void main(String[] args) {
            MyStack stack = new MyStack();
            stack.push(1);
            stack.push(2);
            stack.push(3);
            stack.push(4);
            System.out.println(stack.pop());
            System.out.println(stack.peek());
//            System.out.println(stack.empty());
            System.out.println(stack.isEmpty());
        }

    }
}*/
